package l1j.server.server.model.skill.skillmode;


import l1j.server.server.model.L1Character;
import l1j.server.server.model.L1Magic;
import l1j.server.server.model.Instance.L1NpcInstance;
import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_PacketBox;
import static l1j.server.server.model.skill.L1SkillId.MIRROR_IMAGE;


/**
 * 镜像201
 * @author loli
 *
 */
public class MIRROR_IMAGE extends SkillMode {

	public MIRROR_IMAGE() {
	}

	@Override
	public int start(final L1PcInstance srcpc, final L1Character cha, final L1Magic magic, final int integer) throws Exception {
		final int dmg = 0;//magic.calcMagicDamage(L1SkillId.UNCANNY_DODGE);
		if (!srcpc.hasSkillEffect(MIRROR_IMAGE)) {
			srcpc.setSkillEffect(MIRROR_IMAGE, integer * 1000);
			srcpc.addDodge((byte) 5); //TODO 閃避率 - 50%
			srcpc.sendPackets(new S_PacketBox(88, srcpc.getDodge()));
		}
		return dmg;
	}

	@Override
	public int start(final L1NpcInstance npc, final L1Character cha, final L1Magic magic,
			final int integer) throws Exception {
		final int dmg = 0;
		
		return dmg;
	}

	@Override
	public void start(final L1PcInstance srcpc, final Object obj) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void stop(final L1Character cha) throws Exception {
		cha.addDodge((byte) -5); // 閃避率 - 50%
		if (cha instanceof L1PcInstance) {
			final L1PcInstance pc = (L1PcInstance) cha;
			// 更新閃避率顯示
			pc.sendPackets(new S_PacketBox(88, pc.getDodge()));
		}
	}
}
